﻿using System.Windows;

namespace FormView.UI.PromptView
{
	/// <summary>
	/// Prompt组件接口
	/// </summary>
	public interface IPromptViewControl
	{
		/// <summary>
		/// 获取组件对外呈现的值
		/// </summary>
		/// <returns>组件值</returns>
		object GetValue(FrameworkElement element);

		/// <summary>
		/// 获取组件
		/// </summary>
		/// <param name="value">初始化组件的默认值(可能为null)</param>
		/// <returns></returns>
		FrameworkElement GetElement(PromptFormWindow win, string tipText, object value);

		/// <summary>
		/// 重绘组件时触发
		/// </summary>
		void OnRenderView(PromptFormWindow promptWindow, FrameworkElement element);
	}

	public class PromptDataView
	{
		public static readonly string CHECKBOX_VIEW = PromptCheckBoxView.TagName;
		public static readonly string COMBOBOX_VIEW = PromptComboBoxView.TagName;
		public static readonly string FILE_VIEW = PromptFileView.TagName;
		public static readonly string NUMBER_VIEW = PromptNumberView.TagName;
		public static readonly string PATH_VIEW = PromptPathView.TagName;
		public static readonly string SPEED_VIEW = PromptSpeedView.TagName;
		public static readonly string SWITCH_VIEW = PromptSwitchView.TagName;
		public static readonly string TEXT_VIEW = PromptTextView.TagName;

		public string TipText { get; set; }

		public string PromptTag { get; set; }

		public object DefaultValue { get; set; }

		public PromptDataView(){}

		public PromptDataView(string tipText, string tagName, object defaultValue)
		{
			TipText = tipText;
			PromptTag = tagName;
			DefaultValue = defaultValue;
		}
	}
}
